package cn.lijigou.shopping.service;

import cn.lijigou.shopping.R;
import android.app.Dialog;
import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;

class LookooDialog extends Dialog implements android.view.View.OnClickListener{
    
    private Window window = null;
    private Context context;
    public LookooDialog(Context context)
    {
        super(context);
        this.context=context;
    }
    
    public void showDialog(int layoutResID, int x, int y){
        setContentView(layoutResID);
        Button button=(Button)this.findViewById(R.id.ok);
        button.setOnClickListener(this);
        Button cancel=(Button)this.findViewById(R.id.cancel);
        cancel.setOnClickListener(this);
        windowDeploy(x, y);
        
        //设置触摸对话框意外的地方取消对话框
//        setCanceledOnTouchOutside(true);
        show();
    }
    
    //设置窗口显示
    public void windowDeploy(int x, int y){
        window = getWindow(); //得到对话框
        window.setWindowAnimations(R.style.dialogWindowAnim); //设置窗口弹出动画
        window.setBackgroundDrawableResource(R.color.vifrification); //设置对话框背景为透明
//        WindowManager.LayoutParams wl = window.getAttributes();
//        //根据x，y坐标设置窗口需要显示的位置
//        wl.x = x; //x小于0左移，大于0右移
//        wl.y = y; //y小于0上移，大于0下移  
//        wl.alpha = 0.6f; //设置透明度
//        wl.gravity = Gravity.BOTTOM; //设置重力
//        window.setAttributes(wl);
    }

	
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.ok:
			this.dismiss();
			android.os.Process.killProcess(android.os.Process.myPid());
			System.exit(0); 
			break;
		case R.id.cancel:
			this.dismiss();
			break;
		default:
			break;
		}
	
	}
}
 

